#pragma once
#include "ProToolkitErrors.h"
#include <exception>
#include <sstream>


namespace witotk {


	class ProException	 :public std::exception
	{
	public:
		ProException(void)
		{
			 
		}

		~ProException()
		{
		}

		ProException(const ProException& other)
		{
			mFile = other.mFile;
			mFunc = other.mFunc; 
			mLine = other.mLine;
			datastream << other.datastream;
		}
		ProException& operator=(const ProException& other)
		{
			mFile = other.mFile;
			mFunc = other.mFunc; 
			mLine = other.mLine;
			datastream << other.datastream;
		}

		void init(const char* file, const char* func, int line)
		{
			mFile = file;
			mFunc = func; 
			mLine = line;

		}

		const wchar_t* GetDescribe()
		{
			
			//m_desbuff = datastream.str();
			//return m_desbuff.c_str(); 
			return NULL;
		}

		//LPCTSTR ToString();
		//LPCTSTR ToStringDebug();


		ProException& operator<<( int val )
		{

			datastream<<val;						

			return *this;
		}

		ProException& operator<<( double val )
		{
			datastream<<val;	
			return *this;
		}

		ProException& operator<<( const char* val )
		{
			datastream<<val;	
			return *this;
		}

		ProException& operator<<( const wchar_t* val )
		{
			datastream<<val;	
			return *this;
		}
	 protected:
		const char* mFile;
		const char* mFunc;
		int mLine;
	
		std::wostringstream datastream;
		std::wstring  m_desbuff;
	};


	template<ProError T>
	class ProException_T:public ProException
	{
	public:
		ProException_T(void){}
		static const ProError error = T; 

	};

	class	  GENERAL_ERROR	:public ProException_T<	  PRO_TK_GENERAL_ERROR	>{public:	  GENERAL_ERROR	( ){ }};
	class	  BAD_INPUTS	:public ProException_T<	  PRO_TK_BAD_INPUTS	>{public:	  BAD_INPUTS	( ){ }};
	class	  USER_ABORT	:public ProException_T<	  PRO_TK_USER_ABORT	>{public:	  USER_ABORT	( ){ }};
	class	  E_NOT_FOUND	:public ProException_T<	  PRO_TK_E_NOT_FOUND	>{public:	  E_NOT_FOUND	( ){ }};
	class	  E_FOUND	:public ProException_T<	  PRO_TK_E_FOUND	>{public:	  E_FOUND	( ){ }};
	class	  LINE_TOO_LONG	:public ProException_T<	  PRO_TK_LINE_TOO_LONG	>{public:	  LINE_TOO_LONG	( ){ }};
	class	  CONTINUE	:public ProException_T<	  PRO_TK_CONTINUE	>{public:	  CONTINUE	( ){ }};
	class	  BAD_CONTEXT	:public ProException_T<	  PRO_TK_BAD_CONTEXT	>{public:	  BAD_CONTEXT	( ){ }};
	class	  NOT_IMPLEMENTED	:public ProException_T<	  PRO_TK_NOT_IMPLEMENTED	>{public:	  NOT_IMPLEMENTED	( ){ }};
	class	  OUT_OF_MEMORY	:public ProException_T<	  PRO_TK_OUT_OF_MEMORY	>{public:	  OUT_OF_MEMORY	( ){ }};
	class	  COMM_ERROR	:public ProException_T<	  PRO_TK_COMM_ERROR	>{public:	  COMM_ERROR	( ){ }};
	class	  NO_CHANGE	:public ProException_T<	  PRO_TK_NO_CHANGE	>{public:	  NO_CHANGE	( ){ }};
	class	  SUPP_PARENTS	:public ProException_T<	  PRO_TK_SUPP_PARENTS	>{public:	  SUPP_PARENTS	( ){ }};
	class	  PICK_ABOVE	:public ProException_T<	  PRO_TK_PICK_ABOVE	>{public:	  PICK_ABOVE	( ){ }};
	class	  INVALID_DIR	:public ProException_T<	  PRO_TK_INVALID_DIR	>{public:	  INVALID_DIR	( ){ }};
	class	  INVALID_FILE	:public ProException_T<	  PRO_TK_INVALID_FILE	>{public:	  INVALID_FILE	( ){ }};
	class	  CANT_WRITE	:public ProException_T<	  PRO_TK_CANT_WRITE	>{public:	  CANT_WRITE	( ){ }};
	class	  INVALID_TYPE	:public ProException_T<	  PRO_TK_INVALID_TYPE	>{public:	  INVALID_TYPE	( ){ }};
	class	  INVALID_PTR	:public ProException_T<	  PRO_TK_INVALID_PTR	>{public:	  INVALID_PTR	( ){ }};
	class	  UNAV_SEC	:public ProException_T<	  PRO_TK_UNAV_SEC	>{public:	  UNAV_SEC	( ){ }};
	class	  INVALID_MATRIX	:public ProException_T<	  PRO_TK_INVALID_MATRIX	>{public:	  INVALID_MATRIX	( ){ }};
	class	  INVALID_NAME	:public ProException_T<	  PRO_TK_INVALID_NAME	>{public:	  INVALID_NAME	( ){ }};
	class	  NOT_EXIST	:public ProException_T<	  PRO_TK_NOT_EXIST	>{public:	  NOT_EXIST	( ){ }};
	class	  CANT_OPEN	:public ProException_T<	  PRO_TK_CANT_OPEN	>{public:	  CANT_OPEN	( ){ }};
	class	  ABORT	:public ProException_T<	  PRO_TK_ABORT	>{public:	  ABORT	( ){ }};
	class	  NOT_VALID	:public ProException_T<	  PRO_TK_NOT_VALID	>{public:	  NOT_VALID	( ){ }};
	class	  INVALID_ITEM	:public ProException_T<	  PRO_TK_INVALID_ITEM	>{public:	  INVALID_ITEM	( ){ }};
	class	  MSG_NOT_FOUND	:public ProException_T<	  PRO_TK_MSG_NOT_FOUND	>{public:	  MSG_NOT_FOUND	( ){ }};
	class	  MSG_NO_TRANS	:public ProException_T<	  PRO_TK_MSG_NO_TRANS	>{public:	  MSG_NO_TRANS	( ){ }};
	class	  MSG_FMT_ERROR	:public ProException_T<	  PRO_TK_MSG_FMT_ERROR	>{public:	  MSG_FMT_ERROR	( ){ }};
	class	  MSG_USER_QUIT	:public ProException_T<	  PRO_TK_MSG_USER_QUIT	>{public:	  MSG_USER_QUIT	( ){ }};
	class	  MSG_TOO_LONG	:public ProException_T<	  PRO_TK_MSG_TOO_LONG	>{public:	  MSG_TOO_LONG	( ){ }};
	class	  CANT_ACCESS	:public ProException_T<	  PRO_TK_CANT_ACCESS	>{public:	  CANT_ACCESS	( ){ }};
	class	  OBSOLETE_FUNC	:public ProException_T<	  PRO_TK_OBSOLETE_FUNC	>{public:	  OBSOLETE_FUNC	( ){ }};
	class	  NO_COORD_SYSTEM	:public ProException_T<	  PRO_TK_NO_COORD_SYSTEM	>{public:	  NO_COORD_SYSTEM	( ){ }};
	class	  E_AMBIGUOUS	:public ProException_T<	  PRO_TK_E_AMBIGUOUS	>{public:	  E_AMBIGUOUS	( ){ }};
	class	  E_DEADLOCK	:public ProException_T<	  PRO_TK_E_DEADLOCK	>{public:	  E_DEADLOCK	( ){ }};
	class	  E_BUSY	:public ProException_T<	  PRO_TK_E_BUSY	>{public:	  E_BUSY	( ){ }};
	class	  E_IN_USE	:public ProException_T<	  PRO_TK_E_IN_USE	>{public:	  E_IN_USE	( ){ }};
	class	  NO_LICENSE	:public ProException_T<	  PRO_TK_NO_LICENSE	>{public:	  NO_LICENSE	( ){ }};
	class	  BSPL_UNSUITABLE_DEGREE 	:public ProException_T<	  PRO_TK_BSPL_UNSUITABLE_DEGREE 	>{public:	  BSPL_UNSUITABLE_DEGREE 	( ){ }};
	class	  BSPL_NON_STD_END_KNOTS 	:public ProException_T<	  PRO_TK_BSPL_NON_STD_END_KNOTS 	>{public:	  BSPL_NON_STD_END_KNOTS 	( ){ }};
	class	  BSPL_MULTI_INNER_KNOTS 	:public ProException_T<	  PRO_TK_BSPL_MULTI_INNER_KNOTS 	>{public:	  BSPL_MULTI_INNER_KNOTS 	( ){ }};
	class	  BAD_SRF_CRV	:public ProException_T<	  PRO_TK_BAD_SRF_CRV	>{public:	  BAD_SRF_CRV	( ){ }};
	class	  EMPTY                  	:public ProException_T<	  PRO_TK_EMPTY                  	>{public:	  EMPTY                  	( ){ }};
	class	  BAD_DIM_ATTACH         	:public ProException_T<	  PRO_TK_BAD_DIM_ATTACH         	>{public:	  BAD_DIM_ATTACH         	( ){ }};
	class	  NOT_DISPLAYED          	:public ProException_T<	  PRO_TK_NOT_DISPLAYED          	>{public:	  NOT_DISPLAYED          	( ){ }};
	class	  CANT_MODIFY            	:public ProException_T<	  PRO_TK_CANT_MODIFY            	>{public:	  CANT_MODIFY            	( ){ }};
	class	  CHECKOUT_CONFLICT      	:public ProException_T<	  PRO_TK_CHECKOUT_CONFLICT      	>{public:	  CHECKOUT_CONFLICT      	( ){ }};
	class	  CRE_VIEW_BAD_SHEET     	:public ProException_T<	  PRO_TK_CRE_VIEW_BAD_SHEET     	>{public:	  CRE_VIEW_BAD_SHEET     	( ){ }};
	class	  CRE_VIEW_BAD_MODEL     	:public ProException_T<	  PRO_TK_CRE_VIEW_BAD_MODEL     	>{public:	  CRE_VIEW_BAD_MODEL     	( ){ }};
	class	  CRE_VIEW_BAD_PARENT    	:public ProException_T<	  PRO_TK_CRE_VIEW_BAD_PARENT    	>{public:	  CRE_VIEW_BAD_PARENT    	( ){ }};
	class	  CRE_VIEW_BAD_TYPE      	:public ProException_T<	  PRO_TK_CRE_VIEW_BAD_TYPE      	>{public:	  CRE_VIEW_BAD_TYPE      	( ){ }};
	class	  CRE_VIEW_BAD_EXPLODE   	:public ProException_T<	  PRO_TK_CRE_VIEW_BAD_EXPLODE   	>{public:	  CRE_VIEW_BAD_EXPLODE   	( ){ }};
	class	  UNATTACHED_FEATS       	:public ProException_T<	  PRO_TK_UNATTACHED_FEATS       	>{public:	  UNATTACHED_FEATS       	( ){ }};
	class	  REGEN_AGAIN            	:public ProException_T<	  PRO_TK_REGEN_AGAIN            	>{public:	  REGEN_AGAIN            	( ){ }};
	class	  DWGCREATE_ERRORS       	:public ProException_T<	  PRO_TK_DWGCREATE_ERRORS       	>{public:	  DWGCREATE_ERRORS       	( ){ }};
	class	  UNSUPPORTED            	:public ProException_T<	  PRO_TK_UNSUPPORTED            	>{public:	  UNSUPPORTED            	( ){ }};
	class	  NO_PERMISSION          	:public ProException_T<	  PRO_TK_NO_PERMISSION          	>{public:	  NO_PERMISSION          	( ){ }};
	class	  AUTHENTICATION_FAILURE 	:public ProException_T<	  PRO_TK_AUTHENTICATION_FAILURE 	>{public:	  AUTHENTICATION_FAILURE 	( ){ }};
	class	  OUTDATED               	:public ProException_T<	  PRO_TK_OUTDATED               	>{public:	  OUTDATED               	( ){ }};
	class	  INCOMPLETE             	:public ProException_T<	  PRO_TK_INCOMPLETE             	>{public:	  INCOMPLETE             	( ){ }};
	class	  CHECK_OMITTED          	:public ProException_T<	  PRO_TK_CHECK_OMITTED          	>{public:	  CHECK_OMITTED          	( ){ }};
	class	  APP_TOO_OLD            	:public ProException_T<	  PRO_TK_APP_TOO_OLD            	>{public:	  APP_TOO_OLD            	( ){ }};
	class	  APP_BAD_DATAPATH       	:public ProException_T<	  PRO_TK_APP_BAD_DATAPATH       	>{public:	  APP_BAD_DATAPATH       	( ){ }};
	class	  APP_BAD_ENCODING       	:public ProException_T<	  PRO_TK_APP_BAD_ENCODING       	>{public:	  APP_BAD_ENCODING       	( ){ }};
	class	  APP_NO_LICENSE 	:public ProException_T<	  PRO_TK_APP_NO_LICENSE 	>{public:	  APP_NO_LICENSE 	( ){ }};
	class	  APP_XS_CALLBACKS	:public ProException_T<	  PRO_TK_APP_XS_CALLBACKS	>{public:	  APP_XS_CALLBACKS	( ){ }};
	class	  APP_STARTUP_FAIL	:public ProException_T<	  PRO_TK_APP_STARTUP_FAIL	>{public:	  APP_STARTUP_FAIL	( ){ }};
	class	  APP_INIT_FAIL	:public ProException_T<	  PRO_TK_APP_INIT_FAIL	>{public:	  APP_INIT_FAIL	( ){ }};
	class	  APP_VERSION_MISMATCH   	:public ProException_T<	  PRO_TK_APP_VERSION_MISMATCH   	>{public:	  APP_VERSION_MISMATCH   	( ){ }};
	class	  APP_COMM_FAILURE	:public ProException_T<	  PRO_TK_APP_COMM_FAILURE	>{public:	  APP_COMM_FAILURE	( ){ }};
	class	  APP_NEW_VERSION	:public ProException_T<	  PRO_TK_APP_NEW_VERSION	>{public:	  APP_NEW_VERSION	( ){ }};
	class	  APP_UNLOCK	:public ProException_T<	  PRO_TK_APP_UNLOCK	>{public:	  APP_UNLOCK	( ){ }};

	class RiseProException
	{
	public:
		static void riseError( ProError err,const char* file,const char* fun,int l,const wchar_t* val)
	{

		switch(err)
		{
		case	  PRO_TK_GENERAL_ERROR	:	{	  GENERAL_ERROR	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_BAD_INPUTS	:	{	  BAD_INPUTS	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_USER_ABORT	:	{	  USER_ABORT	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_E_NOT_FOUND	:	{	  E_NOT_FOUND	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_E_FOUND	:	{	  E_FOUND	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_LINE_TOO_LONG	:	{	  LINE_TOO_LONG	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_CONTINUE	:	{	  CONTINUE	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_BAD_CONTEXT	:	{	  BAD_CONTEXT	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_NOT_IMPLEMENTED	:	{	  NOT_IMPLEMENTED	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_OUT_OF_MEMORY	:	{	  OUT_OF_MEMORY	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_COMM_ERROR	:	{	  COMM_ERROR	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_NO_CHANGE	:	{	  NO_CHANGE	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_SUPP_PARENTS	:	{	  SUPP_PARENTS	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_PICK_ABOVE	:	{	  PICK_ABOVE	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_INVALID_DIR	:	{	  INVALID_DIR	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_INVALID_FILE	:	{	  INVALID_FILE	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_CANT_WRITE	:	{	  CANT_WRITE	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_INVALID_TYPE	:	{	  INVALID_TYPE	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_INVALID_PTR	:	{	  INVALID_PTR	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_UNAV_SEC	:	{	  UNAV_SEC	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_INVALID_MATRIX	:	{	  INVALID_MATRIX	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_INVALID_NAME	:	{	  INVALID_NAME	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_NOT_EXIST	:	{	  NOT_EXIST	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_CANT_OPEN	:	{	  CANT_OPEN	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_ABORT	:	{	  ABORT	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_NOT_VALID	:	{	  NOT_VALID	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_INVALID_ITEM	:	{	  INVALID_ITEM	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_MSG_NOT_FOUND	:	{	  MSG_NOT_FOUND	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_MSG_NO_TRANS	:	{	  MSG_NO_TRANS	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_MSG_FMT_ERROR	:	{	  MSG_FMT_ERROR	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_MSG_USER_QUIT	:	{	  MSG_USER_QUIT	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_MSG_TOO_LONG	:	{	  MSG_TOO_LONG	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_CANT_ACCESS	:	{	  CANT_ACCESS	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_OBSOLETE_FUNC	:	{	  OBSOLETE_FUNC	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_NO_COORD_SYSTEM	:	{	  NO_COORD_SYSTEM	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_E_AMBIGUOUS	:	{	  E_AMBIGUOUS	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_E_DEADLOCK	:	{	  E_DEADLOCK	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_E_BUSY	:	{	  E_BUSY	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_E_IN_USE	:	{	  E_IN_USE	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_NO_LICENSE	:	{	  NO_LICENSE	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_BSPL_UNSUITABLE_DEGREE 	:	{	  BSPL_UNSUITABLE_DEGREE 	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_BSPL_NON_STD_END_KNOTS 	:	{	  BSPL_NON_STD_END_KNOTS 	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_BSPL_MULTI_INNER_KNOTS 	:	{	  BSPL_MULTI_INNER_KNOTS 	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_BAD_SRF_CRV	:	{	  BAD_SRF_CRV	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_EMPTY                  	:	{	  EMPTY                  	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_BAD_DIM_ATTACH         	:	{	  BAD_DIM_ATTACH         	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_NOT_DISPLAYED          	:	{	  NOT_DISPLAYED          	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_CANT_MODIFY            	:	{	  CANT_MODIFY            	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_CHECKOUT_CONFLICT      	:	{	  CHECKOUT_CONFLICT      	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_CRE_VIEW_BAD_SHEET     	:	{	  CRE_VIEW_BAD_SHEET     	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_CRE_VIEW_BAD_MODEL     	:	{	  CRE_VIEW_BAD_MODEL     	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_CRE_VIEW_BAD_PARENT    	:	{	  CRE_VIEW_BAD_PARENT    	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_CRE_VIEW_BAD_TYPE      	:	{	  CRE_VIEW_BAD_TYPE      	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_CRE_VIEW_BAD_EXPLODE   	:	{	  CRE_VIEW_BAD_EXPLODE   	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_UNATTACHED_FEATS       	:	{	  UNATTACHED_FEATS       	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_REGEN_AGAIN            	:	{	  REGEN_AGAIN            	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_DWGCREATE_ERRORS       	:	{	  DWGCREATE_ERRORS       	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_UNSUPPORTED            	:	{	  UNSUPPORTED            	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_NO_PERMISSION          	:	{	  NO_PERMISSION          	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_AUTHENTICATION_FAILURE 	:	{	  AUTHENTICATION_FAILURE 	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_OUTDATED               	:	{	  OUTDATED               	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_INCOMPLETE             	:	{	  INCOMPLETE             	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_CHECK_OMITTED          	:	{	  CHECK_OMITTED          	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_APP_TOO_OLD            	:	{	  APP_TOO_OLD            	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_APP_BAD_DATAPATH       	:	{	  APP_BAD_DATAPATH       	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_APP_BAD_ENCODING       	:	{	  APP_BAD_ENCODING       	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_APP_NO_LICENSE 	:	{	  APP_NO_LICENSE 	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_APP_XS_CALLBACKS	:	{	  APP_XS_CALLBACKS	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_APP_STARTUP_FAIL	:	{	  APP_STARTUP_FAIL	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_APP_INIT_FAIL	:	{	  APP_INIT_FAIL	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_APP_VERSION_MISMATCH   	:	{	  APP_VERSION_MISMATCH   	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_APP_COMM_FAILURE	:	{	  APP_COMM_FAILURE	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_APP_NEW_VERSION	:	{	  APP_NEW_VERSION	e;e.init(file,fun,l);e<<val;throw e;}
		case	  PRO_TK_APP_UNLOCK	:	{	  APP_UNLOCK	e;e.init(file,fun,l);e<<val;throw e;}


		}
	}
	};



}//	namespace witotk

#include <sstream>

#define PROE_THROW(err,x)							\
	do											\
{												\
	std::wstringstream buff;buff<<x;			\
	RiseProException::riseError(err,__FILE__, __FUNCTION__, __LINE__,buff.str().c_str());									\
} while (false);
